﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HotelManageSystem.Domain;

namespace HotelManageSystem.Domain.Infrastructure
{
    /// <summary>
    /// Class Name:     DatabaseFactory
    /// Author:         Wenshu Zhang
    /// Creation Date:  2011-12-29
    /// Description:    客户信息
    /// QA:
    /// -----------------------------------------
    /// </summary>
    public  class DatabaseFactory:Disposable ,IDatabaseFactory 
    {
        private HotelManageSystemDbContext dataContext;
        public HotelManageSystemDbContext Get()
        {
            return dataContext ?? (dataContext = new HotelManageSystemDbContext());
        }
        //复制Disposable类中的DisposeCore方法
        protected override void DisposeCore()
        {
            if (dataContext != null)
            {
                dataContext.Dispose();
            }
        }
    }
}
